//package com.xln.furns.web;
//
//import com.xln.furns.entity.Member;
//import com.xln.furns.service.MemberService;
//import com.xln.furns.service.impl.MemberServiceimpl;
//
//import javax.servlet.*;
//import javax.servlet.http.*;
//import java.io.IOException;
//
//public class RegisterServlet extends HttpServlet {
//
//    private MemberService memberService = new MemberServiceimpl();
//
//    @Override
//    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//        doPost(request,response);
//    }
//
//    @Override
//    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//        String username = request.getParameter("username");
//        String password = request.getParameter("password");
//        String email = request.getParameter("email");
//        Member member = new Member(null,username,password,email);
//        if (!memberService.isExistsUsername(username)){
//            if (memberService.registerMember(member)){
//                //System.out.printf("注册成功");
//                //请求转发 知识点：servelt-----------------------------------------------------------
//                request.getRequestDispatcher("/views/member/register_ok.jsp")
//                        .forward(request,response);
//            }else {
//                //System.out.printf("注册失败");
//                request.getRequestDispatcher("/views/member/register_fail.html")
//                        .forward(request,response);
//
//            }
//            //System.out.printf("不存在  2");
//        }else {
//
//            //System.out.printf("用户存在  1");
//            request.getRequestDispatcher("/views/member/login.jsp")
//                    .forward(request,response);
//        }
//    }
//}
